package com.bw;

import com.bw.bean.Student;
import com.bw.controller.StudentController;
import com.bw.service.StuDaoService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.stereotype.Service;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

@SpringBootTest
@RunWith(SpringRunner.class)
public class test {
    @Autowired
    StuDaoService service;
    @Test
    public void add(){
        int i = service.adds(new Student(0, "巨人", "2024-09-01", "2024-09-26", "男", "2000-10-30", 0, 2, null));
        if (i>0){
            System.out.println("添加成功");
        }else{
            System.out.println("添加失败");
        }
    }
    @Test
    public void showall(){
        List<Student> list = service.showall();
        list.forEach(System.out::println);
    }
    @Autowired
    StudentController controller;
    @Test
    public void show(){
        List<Student> list = controller.showall();
        list.forEach(System.out::println);
    }
}
